<template>
  <view class="sticky-box" :style="fixStatusBarHeight">
    <slot></slot>
  </view>
</template>

<script>
export default {
  name: 'MuiSticky',
  props: {
    top: {
      type: Number,
      default: 0
    }
  },
  computed: {
    fixStatusBarHeight() {
      const systemInfo = uni.getSystemInfoSync()
      return {
        top: `${this.top + systemInfo.statusBarHeight}px`
        // paddingTop: `${systemInfo.statusBarHeight}px`,
      }
    }
  }
}
</script>

<style scoped>
.sticky-box {
  /* #ifndef APP-PLUS-NVUE */
  display: flex;
  position: -webkit-sticky;
  /* #endif */
  position: sticky;
  top: 0;
  z-index: 99;
}

.status-bar {
  width: 750rpx;
  background-color: #fff;
}
</style>
